#include <stdio.h>
#include <unistd.h>

#define NUM 100
int main()
{
    char buf[NUM+1] = {0};
    int i = 0;
    const char* str = "|/-\\";
    while(i <= NUM)
    {
         printf("[%-100s][%d%%][%c]\r", buf, i, str[i%4]);
         fflush(stdout);
         buf[i] = '#';
         ++i;
         usleep(100000);
    }
    printf("\n");

    return 0;
}
